package com.hsgene.goods.domain;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.hsgene.common.util.date.TimeJsonDeserializer;

import java.util.Date;

/**
 * 商品检测方式等信息
 *
 * @author wangbing
 * @version 1.0, 2018/7/13
 */
public class GoodsDetectionInfo {

    /**
     * 商品id
     */
    private String goodsId;

    /**
     * 检测信息相关分类
     */
    private String type;

    /**
     * 分类code值
     */
    private Integer code;

    /**
     * 分类对应名称
     */
    private String codeName;

    /**
     * 商品原始支持检测信息
     */
    private Boolean originSupported;

    /**
     * 商城支持检测信息
     */
    private Boolean mallSupported;

    /**
     * 创建时间
     */
    @JsonDeserialize(using = TimeJsonDeserializer.class)
    private Date createTime;

    /**
     * 更新时间
     */
    @JsonDeserialize(using = TimeJsonDeserializer.class)
    private Date updateTime;

    public String getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(String goodsId) {
        this.goodsId = goodsId;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getCodeName() {
        return codeName;
    }

    public void setCodeName(String codeName) {
        this.codeName = codeName;
    }

    public Boolean getOriginSupported() {
        return originSupported;
    }

    public void setOriginSupported(Boolean originSupported) {
        this.originSupported = originSupported;
    }

    public Boolean getMallSupported() {
        return mallSupported;
    }

    public void setMallSupported(Boolean mallSupported) {
        this.mallSupported = mallSupported;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj != null) {
            if (obj instanceof GoodsDetectionInfo) {
                GoodsDetectionInfo other = (GoodsDetectionInfo) obj;
                if (this.goodsId.equals(other.getGoodsId())) {
                    if (this.type.equals(other.getType())) {
                        if (this.code.equals(other.getCode())) {
                            return this.originSupported.equals(other.getOriginSupported())
                                    && this.mallSupported.equals(other.getMallSupported());
                        }
                    }
                }
            }
        }

        return false;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + (goodsId == null ? 0 : goodsId.hashCode());
        result = prime * result + (type == null ? 0 : type.hashCode());
        result = prime * result + (code == null ? 0 : code.hashCode());
        result = prime * result + (originSupported == null ? 0 : originSupported.hashCode());
        result = prime * result + (mallSupported == null ? 0 : mallSupported.hashCode());
        return result;
    }
}
